import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CompanyRiskRatingComponent } from './companyRiskRating.component';
import { CompanyRiskRatingService } from './companyRiskRating.service';
import { CompanyRiskSummaryComponent } from './summary/summary.component';
import { AnalystViewSummaryComponent } from './summary/components/analystView.component';
import { KeyIssuesSummaryComponent } from './summary/components/keyIssues.component';
import { RatingOverviewSummaryComponent } from './summary/components/ratingOverview.component';
import { SubIndustrySummaryComponent } from './summary/components/subIndustry.component';
import { MeiIndicatorsComponent } from './mei/components/indicators.component';
import { AnalystViewMeiComponent } from './mei/components/analystView.component';
import { RatingOverviewMeiComponent } from './mei/components/ratingOverview.component';
import { SubIndustryMeiComponent } from './mei/components/subIndustry.component';
import { EventDetailsComponent } from './mei/components/eventDetails/eventDetails.component';
import { ChartsModule } from '../../../../shared/directives/charts.module';
import { RiskMeiComponent } from './mei/mei.component';
import { PipesModule } from '../../../../shared/pipes/pipes.module';
import { CompanyIndicatorModule } from '../shared/companyIndicator/companyIndicator.module';
import { PillarDetailsComponent } from './mei/components/pillarDetails/pillarDetails.component';
import { CompanyReportDownloadModule } from '../shared/companyHeader/companyReportDownload/companyReportDownload.module';
import { ModalModule } from '../../../../shared/components/modal/modal.module';
import { ReadMoreModule } from '../../../../shared/components/read-more/read-more.module';
import { RiskDetailsComponent } from './risk-details/risk-details.component';

const routes: Routes = [
    {
        path: '',
        component: CompanyRiskRatingComponent,
        children: [
            { path: '', redirectTo: 'summary', pathMatch: 'full' },
            {
                path: 'summary', component: CompanyRiskSummaryComponent, data: {
                    showAsMenu: true,
                    enabled: true,
                    menuItems: [{
                        title: 'Overview',
                        path: ['risk', 'summary']
                    }]
                }
            },
            {
                path: 'mei/:externalId/:type', component: RiskMeiComponent, data: {
                    showAsMenu: true,
                    enabled: true //TODO: set claims if required and on menuItems update call enableMenuRoutes
                }
            }
        ]
    },
    { loadChildren: './companyRiskRating.widget#WidgetModule' } //added to route so we generate a chunk for it
];

/**
 * Risk rating company module
 *
 * Has all changes applied from Git up until 18 of April 2018 (commit  e9060aacd3eae59a4f02873f62a4f41770709476 [e9060aacd3])
 *
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        ChartsModule,
        PipesModule,
        ModalModule,
        CompanyIndicatorModule,
        CompanyReportDownloadModule,
        ReadMoreModule,
        RouterModule.forChild(routes)
    ],
    declarations: [
        CompanyRiskRatingComponent,
        CompanyRiskSummaryComponent,
        AnalystViewSummaryComponent,
        KeyIssuesSummaryComponent,
        RatingOverviewSummaryComponent,
        SubIndustrySummaryComponent,
        RiskDetailsComponent,

        RiskMeiComponent,
        MeiIndicatorsComponent,
        AnalystViewMeiComponent,
        RatingOverviewMeiComponent,
        SubIndustryMeiComponent,
        EventDetailsComponent,
        PillarDetailsComponent
    ]
})
export class CompanyRiskRatingModule { }
